/* 全局样式 */

// Element Plus 自定义主题
:root {
  --el-color-primary: #1890ff;
  --el-color-primary-light-3: #79bbff;
  --el-color-primary-dark-2: #0958d9;
  --el-color-primary-dark-3: #003a8c;

  --el-color-success: #52c41a;
  --el-color-warning: #faad14;
  --el-color-danger: #ff4d4f;
  --el-color-info: #1890ff;

  --el-bg-color: #ffffff;
  --el-bg-color-page: #f2f3f5;
  --el-text-color-primary: #1f2f3d;
  --el-text-color-secondary: #5a6c7d;
}

/* 暗色主题变量 */
html.dark {
  --el-bg-color: #141414;
  --el-bg-color-page: #0f0f0f;
  --el-text-color-primary: #e5eaf3;
  --el-text-color-secondary: #a3a6ad;
}

/* 全局基础样式 */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--el-bg-color-page);
  color: var(--el-text-color-primary);
}

#app {
  height: 100vh;
}

/* 通用工具类 */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.ml-3 { margin-left: 12px; }
.ml-4 { margin-left: 16px; }
.ml-5 { margin-left: 20px; }

.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mr-3 { margin-right: 12px; }
.mr-4 { margin-right: 16px; }
.mr-5 { margin-right: 20px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }

/* 卡片阴影效果 */
.card-shadow {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-shadow-hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;

  &:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--el-bg-color-page);
}

::-webkit-scrollbar-thumb {
  background: var(--el-text-color-secondary);
  border-radius: 3px;

  &:hover {
    background: var(--el-text-color-primary);
  }
}

/* 响应式断点 */
@media (max-width: 768px) {
  .hide-on-mobile {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .hide-on-tablet {
    display: none !important;
  }
}

/* Element Plus 组件自定义样式 */
.el-card {
  border-radius: 8px;
}

/* 导航菜单样式强化 */
.el-menu--horizontal .el-menu-item {
  &:not(.is-disabled):hover,
  &:not(.is-disabled).is-active {
    background: transparent !important;
    border-bottom-color: currentColor !important;
  }
}

/* 顶部导航栏菜单项颜色修复 */
.app-header .nav-menu .el-menu-item {
  &.is-active {
    .el-icon,
    span {
      color: inherit !important;
    }
  }
}

.el-button {
  border-radius: 6px;
}

.el-table {
  .el-table__header {
    th {
      background-color: var(--el-bg-color-page);
      font-weight: 600;
    }
  }
}

.el-dialog {
  border-radius: 8px;
}

.el-message-box {
  border-radius: 8px;
}

/* 加载动画 */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--el-color-primary-light-3);
  border-top: 2px solid var(--el-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 状态标签样式 */
.status-tag {
  &.success {
    background-color: #f0f9eb;
    color: #67c23a;
    border: 1px solid #b2e8d1;
  }

  &.warning {
    background-color: #fdf6ec;
    color: #e6a23c;
    border: 1px solid #f5dab1;
  }

  &.danger {
    background-color: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fbc4c4;
  }

  &.info {
    background-color: #f0f9ff;
    color: #409eff;
    border: 1px solid #b2d8ff;
  }
}

/* 渐变背景 */
.gradient-primary {
  background: linear-gradient(135deg, var(--el-color-primary) 0%, var(--el-color-primary-light-3) 100%);
}

.gradient-success {
  background: linear-gradient(135deg, var(--el-color-success) 0%, #95de64 100%);
}

.gradient-warning {
  background: linear-gradient(135deg, var(--el-color-warning) 0%, #ffd666 100%);
}

.gradient-danger {
  background: linear-gradient(135deg, var(--el-color-danger) 0%, #ff7875 100%);
}